<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript" src="../js/jquery-3.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$(":button:first").click(function(){
		if($(":text:first").val()==""){
			alert("请输入商品名称");
		}else if($(":text:eq(1)").val()==""){
			alert("请输入商品价格");
		}else if($(":text:eq(2)").val()==""){
			alert("请输入商品库存");
		}else if($(":text:eq(3)").val()==""){
			alert("请输入商品类型id");
		}else{
			$("form").submit();
		}
	});
});
</script>
</head>
<body>
<form action="${empty param.id?'AddGoodsServlet':'UpdateGoodsServlet'}">
商品名称：<input type="text"  name="name" value="${param.name }"><br>
商品价格：<input type="text"  name="price" value="${param.price }"><br>
商品库存：<input type="text"  name="account" value="${param.account }"><br>
商品类型:<input type="text"  name="id" value="${param.id }"><br>
<input type="hidden" name="id" value="${param.id}">
<input type="button" value="${empty param.id?'添加':'修改' }">
</form>
</body>
</html>